package com.rbac.web.common;

import java.util.concurrent.TimeUnit;

/**
 * @author gengaoliu
 */
public class Constant {

  private Constant() {}

  private static final String USER_ROLE = "user_role";
  private static final String STRING_SPLIT = ":";
  private static final String USER_NAME = "username";
  private static final String TOKEN = "token";
  private static final String USER_KEY = "users";
  public static final long TOKEN_EXPIRE_TIME = 7;
  public static final TimeUnit TOKEN_TIME_UNIT = TimeUnit.DAYS;
  public static final long IMG_CODE_EXPIRE_TIME = 60;
  public static final TimeUnit IMG_CODE_EXPIRE_UNIT = TimeUnit.SECONDS;
  public static final String DIM = "dim";
  public static final String FINDALLBYCODE = "findAllByCode";

  public static String getUserRoleKey(Integer userId) {
    return USER_ROLE + STRING_SPLIT + userId;
  }

  public static String getUserNameKey(String username) {
    return USER_NAME + STRING_SPLIT + username;
  }

  public static String getTokenKey(String token) {
    return TOKEN + STRING_SPLIT + token;
  }

  public static String getUserKey() {
    return USER_KEY;
  }

  public static String getRBKey() {
    return DIM + STRING_SPLIT + FINDALLBYCODE;
  }
}
